<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" %>
<%@include file="/static/common/taglib.jsp" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
    <title>181故障查询</title>
    <%@include file="../../public/commonCss.jsp" %>
    <%@include file="../../public/commonJs.jsp" %>
</head>
<body ms-controller="main" class="ms-controller">
<div id="wrapper">
    <div class="boxtoolbar whiteBox actionArea contentbox">
        <div class="layui-inline">
            <div class="layui-input-inline">
                <input type="text" ms-duplex="searchKey.startDate" class="layui-input Wdate" placeholder="搜索上报日期"
                       onClick="WdatePicker({readOnly:true,maxDate:'%y-%M-%d'})"/>
            </div>
        </div>
        <div class="layui-inline">
            <div class="layui-input-inline">
                <input type="text" ms-duplex="searchKey.endDate" placeholder="结束日期"
                       class="layui-input Wdate" onClick="WdatePicker({readOnly:true,maxDate:'%y-%M-{%d+1}'})"/>
            </div>
        </div>
        <div class="layui-inline">
            <div class="layui-input-inline">
                <input type="text" ms-duplex="searchKey.searchKey"
                       placeholder="人员姓名、人员编号" class="layui-input"/>
            </div>
        </div>
        <div class="layui-inline">
            <div class="layui-input-inline">
                <button class="layui-btn layui-btn-normal layui-btn-small" ms-on-click="loadSearchData()">搜索</button>
            </div>
        </div>
        <div class="layui-inline">
            <div class="layui-input-inline">
                <button class="layui-btn layui-btn-small" onclick="exportExcel()">导出excel</button>
            </div>
        </div>
    </div>
    <div class="boxmain whiteBox lrbox" style="margin-top:-90px">
        <div class="lrboxmain borderL" style="margin-left:0%">
            <div class="from-body contentbox" style=" overflow: auto;">
                <table class="layui-table">
                    <thead>
                    <tr>
                        <th>行号</th>
                        <th>人员姓名</th>
                        <th>车次</th>
                        <th>车号</th>
                        <th width="300">故障内容</th>
                        <th>故障类别</th>
                        <th>故障上报时间</th>
                    </tr>
                    </thead>
                    <tbody>
                    <tr ms-repeat="tableData">
                        <td>{{(page.currentPage-1)*page.pageSize+$index+1}}</td>
                        <td>{{el.userName}}</td>
                        <td>{{el.trainCode}}</td>
                        <td>{{el.trainNum}}-{{el.trainNo}}</td>
                        <td>{{el.problemContent}}</td>
                        <td>{{el.typeName}}</td>
                        <td>{{el.createTime}}</td>
                    </tr>
                    </tbody>
                </table>
                <!-- 分页 -->
                <div id="demo" class="fenye">
                </div>
            </div>
        </div>
    </div>
    <!-- whitebox -->
</div>
<script type="text/javascript">
    var vm;
    avalon.ready(function () {
        vm = avalon.define({
            $id: "main",
            tableData: [],//图片数据
            page: {
                currentPage: 1,
                pageSize: 50,
                totalPage: 0
            },
            searchKey: {
                searchKey: "",
                startDate: "${today}",//记录日期
                endDate: "${tomorrow}"
            }
        });
        avalon.scan();
        loadTableData();
    });

    //搜索
    function loadSearchData() {
        loadTableData();
    }

    //导出excle
    function exportExcel() {
        window.location.href = '${ctx}/oeoProblem/exportOeoProblems.action?startDate=' + vm.$model.searchKey.startDate + '&endDate=' + vm.$model.searchKey.endDate;
    }

    //加载表格数据
    function loadTableData(curr) {
        var dataStr = jsonUtil.mergeJsonObj(vm.$model.searchKey, vm.$model.page);
        ajaxUtil.postDealCode("${ctx}/emergeFileController/selectOnePage.action", dataStr, true, function (data) {
            vm.tableData = data.result;
            vm.page.totalPage = data.totalPage;
            pageUtil.renderPage(vm.page, loadTableData, "demo");
        });

    }
</script>
</body>
</html>